package com.lishe.lishe.lishe.module.myorder.bean;

import android.view.View;

import com.google.gson.annotations.SerializedName;
import com.lishe.base.common.adapter.base.ViewHolder;
import com.lishe.lishe.R;
import com.lishe.lishe.lishe.module.myorder.adapter.OrderAdapter;
import com.lishe.lishe.net.BaseProtocal;

import java.util.List;

/**
 * 标    题：
 * 功能描述：
 * 作    者：zouxx
 * 创建时间：2018/8/21
 */

public class OrderListResponse extends BaseProtocal {

    public DataBean data;

    public static class DataBean {
        public int page;
        public int pageSize;
        public int totalCount;
        public int totalPage;
        public List<ListBean> list;

        public static class ListBean {
            public String payment_id;
            public String tid;
            public String money;
            public String created_time;
            public int order_status;
            public int sys_time;
            public int num;
            public boolean isReminder;
            public List<ProductsBean> products;

            /**
             * 去支付
             */
            public long getTimeLeftToPay() {
                long currentTime = System.currentTimeMillis();
                return  60 * 30 * 1000 - (currentTime - Long.parseLong(created_time) * 1000);
            }

            public String getOrderStatusText() {
                String orderText = "";
                switch (order_status) {
                    case 1: //超时失效
                    case 2: //用户手动取消
                    case 3: //被客服取消
                        orderText =  "订单已失效";
                    break;
                    case 4:
                        orderText =  "待付款";
                    break;
                    case 5:
                        orderText =  "待发货";
                    break;
                    case 6:
                        orderText =  "待收货";
                    break;
                    case 7:
                    case 8:
                        orderText =  "交易成功";
                    break;
                    case 9:
                        orderText =  "售货订单";
                    break;
                    default:
                        orderText =  "未知状态";
                    break;
                }
                return orderText;
            }

            public static class ProductsBean {
                public String tid;
                public String shop_id;
                public String shop_name;
                public String title;
                public String item_id;
                public String sku_id;
                public String price;
                public String original_price;
                public String num;
                public String total_weight;
                public String pic_path;
                public String spec_info;
            }
        }
    }
}
